import com.xywang.dao.BookMapper;
import com.xywang.pojo.Books;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MyText {
    @Test
    public void test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookMapper impl = context.getBean("bookMapperImpl", BookMapper.class);
        List<Books> books = impl.selectAllBooks();
        for (Books book : books) {
            System.out.println(book.toString());
        }
    }
    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookMapper impl = context.getBean("bookMapperImpl", BookMapper.class);
        Books books = new Books(1,"123", 123, "123");
        impl.addBook(books);
        test();
    }
}
